﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MindBreaker.GameObjects;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace MindBreaker.LevelManagement
{
    class LevelCase : GameObject
    {
        /***************/
        /** CONSTANTS **/
        /***************/

        public const int DEFAULT_CASE_WIDTH = 50;
        public const int DEFAULT_CASE_HEIGHT = 25;
        public const int DEFAULT_CASE_RESISTANCE = 1;

        /****************/
        /** ATTRIBUTES **/
        /****************/

        private int _resistance;
        private int _casePositionX;
        private int _casePositionY;

        /******************/
        /** CONSTRUCTORS **/
        /******************/

        public LevelCase(int posX, int posY, Game game, String textureKey)
            : base(game, textureKey, DEFAULT_CASE_WIDTH * posX, DEFAULT_CASE_HEIGHT * posY)
        {
            this.InitVars(DEFAULT_CASE_RESISTANCE, posX, posY);
        }

        /*
        public void UpdateBoundingBox()
        {
            this._boundingBox.Min = new Vector3(this.GameObject.PosX, this.GameObject.PosY, 0);
            this._boundingBox.Max = new Vector3(this.GameObject.PosX + this.GameObject.Width, this.GameObject.PosY + this.GameObject.Height, 0);
        }
        */

        /**
         * Gestion des attributs de la case
         */
        public void InitVars(int resistance, int posX, int posY)
        {
            this.Resistance = resistance;
            this.CasePositionX = posX;
            this.CasePositionY = posY;
        }

        public override void Initialize()
        {
            base.Initialize();
            PhysicEngine.getInstance().add(this);
        }

        protected override void LoadContent()
        {
            base.LoadContent();
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
        }

        /****************/
        /** PROPERTIES **/
        /****************/

        public int Resistance
        {
            get { return _resistance; }
            set { _resistance = value; }
        }

        public int CasePositionX
        {
            get { return this._casePositionX; }
            set { this._casePositionX = value; }
        }

        public int CasePositionY
        {
            get { return this._casePositionY; }
            set { this._casePositionY = value; }
        }
    }
}
